package rmi.analytics.server;

import java.rmi.RemoteException;

import org.apache.log4j.Logger;

import rmi.eventing.types.Event;

//Safes all MC Stub, filter an subscriptionID

public class RMISession {
	public static Logger log = Logger.getLogger(RMISession.class);
	private RemoteClientAnalyticsInterface rci=null;
	private String filter = "";
	private int subcsriptionID; 
	
	
	public RMISession(RemoteClientAnalyticsInterface rci, String filter, int subcsriptionID){
		this.rci=rci;
		this.filter=filter;
		this.setSubcsriptionID(subcsriptionID);
	}
	public void sendEvent(Event ev) throws RemoteException{
		
		if(ev.getType().matches(filter.replace("'",""))){
			
				rci.processEvent(ev);
			
		}
		
	}
	public int getSubcsriptionID() {
		return subcsriptionID;
	}
	public void setSubcsriptionID(int subcsriptionID) {
		this.subcsriptionID = subcsriptionID;
	}
	

}
